package org.android.quiz;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;

public class AnswerView extends Activity {
	
	private LinearLayout onePlate;
	private LinearLayout twoPlate;
	private LinearLayout thereePlate;
	private LinearLayout fourPlate;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.quiz);
		
		onePlate = (LinearLayout)findViewById(R.id.onePlate);
		onePlate.setOnTouchListener(new OnTouchListener () {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					onePlate.setBackgroundColor(Color.RED);
				} else if (event.getAction() == MotionEvent.ACTION_UP) {
					onePlate.setBackgroundColor(Color.BLACK);
				}
				return true;
			}
		});
		
		twoPlate = (LinearLayout)findViewById(R.id.twoPlate);
		twoPlate.setOnTouchListener(new OnTouchListener () {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					twoPlate.setBackgroundColor(Color.RED);
				} else if (event.getAction() == MotionEvent.ACTION_UP) {
					twoPlate.setBackgroundColor(Color.BLACK);
				}
				return true;
			}
		});
		
		thereePlate = (LinearLayout)findViewById(R.id.threePlate);
		thereePlate.setOnTouchListener(new OnTouchListener () {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					thereePlate.setBackgroundColor(Color.RED);
				} else if (event.getAction() == MotionEvent.ACTION_UP) {
					thereePlate.setBackgroundColor(Color.BLACK);
				}
				return true;
			}
		});
		
		fourPlate = (LinearLayout)findViewById(R.id.fourPlate);
		fourPlate.setOnTouchListener(new OnTouchListener () {
			public boolean onTouch(View v, MotionEvent event) {
				if (event.getAction() == MotionEvent.ACTION_DOWN) {
					fourPlate.setBackgroundColor(Color.RED);
				} else if (event.getAction() == MotionEvent.ACTION_UP) {
					fourPlate.setBackgroundColor(Color.BLACK);
				}
				return true;
			}
		});
	}
}
